package com.admin.service;

import com.admin.bean.KeywordType;
import com.admin.dbdao.KeywordTypeDao;
import com.data.util.CheckDataUtils;
import com.data.util.DatabaseIdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 分辨率服务层
 *
 * @author:HingLo
 * @create 2017-09-11 15:35
 **/
@Service
public class KeywordTypeService {
    @Autowired
    private KeywordTypeDao keywordTypeDao;

    public List<KeywordType> findAllServcie() {
        List<KeywordType> list = keywordTypeDao.findAllDao();
        return list.size() > 0 ? list : null;
    }


    /**
     * 添加
     *
     * @param keywordType
     * @return
     */
    public boolean addResolvingService(KeywordType keywordType) {
        if (keywordType.getId() == null) {
            keywordType.setId(DatabaseIdUtils.getDataIdOne());
        }
        keywordType.setCtime(new Date());
        return keywordTypeDao.addkeywordTypeDao(keywordType);
    }


    /**
     * 删除分辨率信息
     *
     * @param id
     * @return
     */
    public boolean delResolvingService(String id) {
        if (CheckDataUtils.stringUtils(id)) {
            id = id.trim();
            return keywordTypeDao.delkeywordTypeDao(id);

        }
        return false;
    }

}
